package com.alibaba.algo.cooperation.feign.service;

import com.alibaba.algo.cooperation.common.BaseResult;
import com.alibaba.algo.cooperation.feign.config.FeignConfiguration;
import com.alibaba.algo.cooperation.feign.vo.req.GetGroupBaseInfoReqVO;
import com.alibaba.algo.cooperation.feign.vo.req.SelectGroupPageRequestVO;
import com.alibaba.algo.cooperation.feign.vo.req.XbomReqParamVO;
import com.alibaba.algo.cooperation.feign.vo.res.GroupBaseInfoResponseVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import javax.validation.constraints.NotNull;

/**
 * 类SysGroupService.java的实现描述：人员组 service
 *
 * @author fan.tianpeng 2021-05-06 19:30:27
 */
@FeignClient(url = "${feign.userCenterUrl:}", value = "usercenter-service", contextId = "sysGroup", configuration = FeignConfiguration.class)
@Api(tags = "人员组管理", value = "人员组管理")
public interface GroupFeignService {

    /**
     * 人员组分页查询
     *
     * @param vo 入参
     * @return 分页结果
     */
    @ApiOperation(value = "获取人员组信息列表")
    @RequestMapping(value = "feignApi/userCenter/sysGroup/selectPage", method = RequestMethod.POST)
    BaseResult selectPage(@RequestBody SelectGroupPageRequestVO vo);

    /**
     * 人员组详情页查询
     *
     * @param vo
     * @return
     */
    @ApiOperation(value = "根据人员组id获取人员组下员工详情信息")
    @RequestMapping(value = "feignApi/userCenter/sysGroup/selectEmployeeDetailPageByGroupId", method = RequestMethod.POST)
    BaseResult selectEmployeeDetailPageByGroupId(@RequestBody SelectGroupPageRequestVO vo);


    @ApiOperation(value = "根据人员组id获取人员组下员工信息")
    @RequestMapping(value = "feignApi/userCenter/sysGroup/selectEmployeeByGroupId", method = RequestMethod.POST)
    BaseResult selectEmployeeByGroupId(@RequestParam("groupId") @NotNull(message = "用户组ID不能为空") Long groupId);

    /**
     * 根据用户姓名，模糊搜索所有群组下的模糊匹配的列表（有条件则返回人员清单，无则返回人数）
     *
     * @param vo
     * @return
     */
    @ApiOperation(value = "根据人员信息模糊匹配人员组信息")
    @RequestMapping(value = "feignApi/userCenter/sysGroup/selectGroupPageByEmployeeCondition", method = RequestMethod.POST)
    BaseResult selectGroupPageByEmployeeCondition(@RequestBody SelectGroupPageRequestVO vo);

    @ApiOperation(value = "通过人员组Id或Code查询人员组基本信息")
    @RequestMapping(value = "feignApi/userCenter/sysGroup/getGroupBaseInfoByIdOrCode", method = RequestMethod.POST)
    BaseResult<GroupBaseInfoResponseVO> getGroupBaseInfoByIdOrCode(@RequestBody GetGroupBaseInfoReqVO paramVO);

    @ApiOperation(value = "通过人group_code/group_name模糊查询人员组基本信息")
    @RequestMapping(value = "feignApi/userCenter/sysGroup/likeSearch", method = RequestMethod.POST)
    BaseResult getGroupBaseInfoByCode(@RequestParam(value = "groupCode") String groupCode, @RequestParam(value = "groupName") String groupName);

    @ApiOperation(value = "xbom组中新增/删除人员接口")
    @RequestMapping(value = "feignApi/userCenter/sysGroup/modifiedFromXbom", method = RequestMethod.POST)
    BaseResult modifiedFromXbom(@RequestBody XbomReqParamVO vo);

    @ApiOperation(value = "xbom组查询接口")
    @RequestMapping(value = "feignApi/userCenter/sysGroup/qryGroupDetailByGroupCodeFromXbom", method = RequestMethod.POST)
    BaseResult qryGroupDetailByGroupCodeFromXbom(@RequestParam(value = "groupCode") @NotNull(message = "人员组编码参数不能为空") String groupCode);
}
